<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            background-color: #e8e8e8;
            width: 840px;
            margin: 0 auto;
        }

        .box2 {
            float: left;
            height: 300px;
            width: 200px;
            margin: 0 5px;
            background-color: pink;
        }

        /* .box3 {
            height: 300px;
            width: 200px;
            margin: 0 5px;
            background-color: pink;
        } */

        .clear {
            clear: both;
        }
    </style>
</head>

<body>
    <div class="box">

        <div class="box2">1</div>
        <div class="box2">2</div>
        <div class="box2">3</div>
        <div class="box2">4</div>
        <div class="box2">5</div>
        <div class="box2">6</div>
        <div class="box2">7</div>
        <div class="box2">8</div>



        <!-- 这个新增的盒子要求必须是块级元素不能是行内元素 -->
        <!-- <span class="clear"></span> -->
        <div class="clear"></div>
    </div>
</body>

</html>